![]() ![]() |
Q: Are there any guidelines for the value of the depth field when creating Image Descriptions? A: The Image Compression Manager uses Image Descriptions to describe compressed and uncompressed image data. Sometimes these are created for you by an API like MakeImageDescriptionForPixMap or GraphicsImportGetImageDescription. However, sometimes you need to create an image description yourself. The "depth" field of an image description does not always contain a literal number of bits per pixel. Instead, it should be the QuickDraw pixel size that most closely describes the image data. This enables applications to broadly understand properties of a compressed image without needing to know specific details. Information about where the true depth gets stored is covered in 'Section 2' of this document. Section 1 - The Depth Field: When filling in the depth field directly, use the following guide:
Otherwise use 24 if the image doesn't match any of the above criteria. This is the generic "color with no alpha channel" depth. For YUV pixel formats without alpha, use 24. Although YUV9 is 9 bits per pixel, YUV 4:2:0 is 12 bits per pixel, and YUV 4:2:2 is 16 bits per pixel, you should still use 24. Follow the above guidelines even for pixel formats with samples deeper than 8-bit. For example, 48-bit RGB should use depth 24 and 64-bit ARGB should use depth 32.
In QuickTime 6.0 there is a new API, QTGetPixelFormatDepthForImageDescription, which returns the appropriate depth code for any registered pixel format. Section 2 - Where should information about the true depth get stored: When the image data in question is an uncompressed pixel array of a big-endian pixel format that QuickDraw supports (specifically, 1, 2, 4, 8, 16, 24, 32, 33, 34, 36, or 40), the cType field of the image description should be kRawCodecType and the depth field (as discussed above) should be the pixel format. For example, for 8-bit grayscale, the cType field should contain kRawCodecType and the depth field should contain 40. When the image data in question is an uncompressed pixel array of a non-QuickDraw pixel format, the cType field of the image description should be the pixel format code. For example, k2vuyPixelFormat ('2vuy'). In this case the depth field (as discussed above) should contain 24. When the image data in question is compressed, but has a special native pixel format that it can be decompressed directly into, the pixel format should be stored as a big-endian OSType in an image description extension of type kImageDescriptionColorSpace ('cspc'). The value of the cType field should reflect the way the image data was compressed. For example, a PNG file containing a 48-bit-per-pixel RGB image would be described by an image description with a cType of kPNGCodecType ('png '), a big-endian kImageDescriptionColorSpace ('cspc') image description extension containing the OSType k48RGBCodecType ('b48r') and a depth field (as discussed above) containing the value 24. If your application needs more detailed information about registered pixel formats, use the ICMGetPixelFormatInfo API. References:Working with ImageDescriptions QTGetPixelFormatDepthForImageDescription - What's new in QuickTime 6 PDF TechNote 2057 - Fill in the size field before calling ICMGetPixelFormatInfo
|
Developer Documentation | Technical Notes | Development Kits | Sample Code |